var t = getApp();

Page({
    data: {
        list: [],
        usable: 0,
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(t) {
        wx.setNavigationBarTitle({
            title: "权益积分"
        }), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this.getMoreData() : console.log("没有更多了");
    },
    onShareAppMessage: function() {},
    getData: function() {
        var a = this, o = t.getNetAddresss("plugin.equity-points.frontend.controllers.point.index");
        t._getNetWork({
            url: o,
            success: function(t) {
                var o = t.data;
                1 == o.result && (a.data.isLoadMore = !0, a.data.total_page = o.data.list.last_page, 
                a.data.total_page || (a.data.total_page = 0), a.setData({
                    list: o.data.list.data,
                    usable: o.data.usable
                }));
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getMoreData: function() {
        var a = this, o = "";
        this.data.isLoadMore = !1, this.data.page >= this.data.total_page || (this.data.page = this.data.page + 1, 
        o = t.getNetAddresss("plugin.equity-points.frontend.controllers.point.index"), t._postNetWork({
            url: o,
            data: {
                page: this.data.page
            },
            success: function(t) {
                var o = t.data;
                1 == o.result ? (a.data.isLoadMore = !0, a.setData({
                    list: a.data.list.concat(o.data.list.data)
                })) : (a.data.page = a.data.page - 1, a.isLoadMore = !1, wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                }));
            },
            fail: function(t) {
                console.log(t);
            }
        }));
    }
});